package com.green.web.controller.manage;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import net.sf.json.JSONObject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.green.common.page.Pagination;
import com.green.model.manage.OperateLog;
import com.green.model.manage.enums.OperateLogTypeEnum;
import com.green.service.manage.OperateLogService;
import com.green.web.controller.common.BaseController;

/**
 * 操作日志
 * @author 谷辉
 *
 */
@Controller
@RequestMapping(value = "/operateLog/*")
public class OperateLogController extends BaseController{

	@Resource
	private OperateLogService operateLogService;
		
	
	// query省、市等信息
	@RequestMapping(value = "manager")
	public String manager(ModelMap modelMap) {
		modelMap.put("operateLogTypeList", OperateLogTypeEnum.toList());
		return "manage/OperateLogManager";
	}
	/**
	 * 查询提成发放信息
	 * 
	 * @param modelMap
	 * @return
	 * @throws ParseException
	 */
	@RequestMapping("listData")
	@ResponseBody
	public void listData(Pagination<OperateLog> page,HttpServletResponse response) {
		Map<String, Object> param = new HashMap<String, Object>();
		param.put("operateLogType", getString("operateLogType"));
		param.put("personName", getString("personName"));
		param.put("ip", getString("ip"));
		param.put("content", getString("content"));
		param.put("startDate", getString("startDate"));
		param.put("endDate", getString("endDate"));

		page =operateLogService.getOperateLogPagination(page, param);
        
		outPrint(response, JSONObject.fromObject(page, getDefaultJsonConfig()));
	}
}
